(function(){"use strict";BX.namespace("BX.Landing.UI.Factory");var e=BX.Landing.Utils.isFunction;var t=BX.Landing.Utils.assign;BX.Landing.UI.Factory.FieldFactory=function(t){this.uploadParams=t.uploadParams||{};this.linkOptions=t.linkOptions||{};this.selector=t.selector;this.onChangeHandler=e(t.onChange)?t.onChange:function(){};this.onValueChangeHandler=e(t.onValueChange)?t.onValueChange:function(){}};BX.Landing.UI.Factory.FieldFactory.prototype={create:function(e){if(e.type==="text"){return new BX.Landing.UI.Field.Text({title:e.name,selector:this.selector,content:e.value,placeholder:e.placeholder,description:e.description,textOnly:true,onInput:e.onInput,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="date"){return new BX.Landing.UI.Field.Date({title:e.name,selector:this.selector,content:e.value,placeholder:e.placeholder,description:e.description,textOnly:true,onInput:e.onInput,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,time:e.time,format:e.format,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="html"){return new BX.Landing.UI.Field.Html({title:e.name,selector:this.selector,content:e.value,placeholder:e.placeholder,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,disabled:BX.Text.toBoolean(e.disabled)})}if(!e.type||e.type==="list"||e.type==="dropdown"){return new BX.Landing.UI.Field.Dropdown({title:e.name,selector:this.selector,items:e.items,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,disabled:BX.Text.toBoolean(e.disabled),dependency:e.dependency,hint:e.hint})}if(e.type==="image"){return new BX.Landing.UI.Field.Image({title:e.name,selector:this.selector,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,uploadParams:this.uploadParams,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="icon"){e.value=BX.Landing.Utils.isPlainObject(e.value)?e.value:{};return new BX.Landing.UI.Field.Icon({title:e.name,selector:this.selector,content:{type:"icon",src:"",alt:"",classList:"classList"in e.value?e.value.classList:[]},onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="link"){return new BX.Landing.UI.Field.Link({title:e.name,selector:this.selector,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,options:this.linkOptions,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="url"){e=t({},e,{title:e.name,content:e.value,selector:this.selector,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,options:this.linkOptions,textOnly:true,disabled:BX.Text.toBoolean(e.disabled)});return new BX.Landing.UI.Field.LinkUrl(e)}if(e.type==="dynamic_source"){e=t({},e,{title:e.name,content:e.value,selector:this.selector,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,options:this.linkOptions,textOnly:true,currentPageOnly:e.currentPageOnly,allowedTypes:["block"],disableCustomURL:true,disallowType:true,customPlaceholder:BX.Landing.Loc.getMessage("LANDING_BLOCK__BLOCK_SOURCE_PLACEHOLDER"),panelTitle:BX.Landing.Loc.getMessage("LANDING_BLOCK__BLOCK_SOURCE_PLACEHOLDER"),disabled:BX.Text.toBoolean(e.disabled)});return new BX.Landing.UI.Field.LinkUrl(e)}if(e.type==="slider"||e.type==="range-slider"){return new BX.Landing.UI.Field.Range({title:e.name,selector:this.selector,items:e.items,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,frame:window,type:e.type==="range-slider"?"multiple":null,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="palette"){return new BX.Landing.UI.Field.ColorPalette({title:e.name,selector:this.selector,items:e.items,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="color"){return new BX.Landing.UI.Field.ColorField({title:e.name,selector:this.selector,subtype:e.subtype,content:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="catalog-view"){return new BX.Landing.UI.Field.DragAndDropList({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="sortable-list"){return new BX.Landing.UI.Field.SortableList({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="position"){return new BX.Landing.UI.Field.Position({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,mode:e.mode,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="checkbox"){return new BX.Landing.UI.Field.Checkbox({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,compact:e.compact,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="radio"){return new BX.Landing.UI.Field.Radio({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,compact:e.compact,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="multiselect"){return new BX.Landing.UI.Field.MultiSelect({title:e.name,selector:this.selector,items:e.items,value:e.value,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,disabled:BX.Text.toBoolean(e.disabled)})}if(e.type==="filter"){return new BX.Landing.UI.Field.Filter({title:e.name,selector:this.selector,items:e.items,value:e.value,html:e.html,filterId:e.filterId,onChange:this.onChangeHandler,onValueChange:this.onValueChangeHandler,attribute:e.attribute,attrKey:e.attrKey,property:e.property,disabled:BX.Text.toBoolean(e.disabled)})}}}})();
//# sourceMappingURL=field_factory.map.js